<div class="form-container">
<div class="validation-errors" id="validationErrors" style="display: none;"></div>
<?php
	Includes::IncludeFile( Includes::$FORM );
	Includes::IncludeFile( Includes::$SPACER );

	echo( form_open(base_url() . 'index.php/new_member_sign_up/step2_process/', array('id' => 'newMemberStep2Form') ) );

		Form::OpenFormItem('Spouse User Name*:', 260);
			echo( form_input(array('name'=>'userName','id'=>'userName','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Spouse Password*:', 260);
			echo( form_password(array('name'=>'password','id'=>'password','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		
		Spacer::Render(0, 15);
		
		Form::OpenFormItem('Spouse First Name*:', 260);
			echo( form_input(array('name'=>'firstName','id'=>'firstName','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Spouse Last Name*:', 260);
			echo( form_input(array('name'=>'lastName','id'=>'lastName','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Spouse Gender*:', 260);
			$genderOptions = array(''=>'Select','male'=>'Male','female'=>'Female');
			echo( form_dropdown('gender', $genderOptions, '', 'id="gender" style="width: 100px;" ') );
		Form::CloseFormItem();
		
		Spacer::Render(0, 15);
		
		Form::OpenFormItem('Spouse Primary Email*:', 260);
			echo( form_input(array('name'=>'primaryEmail','id'=>'primaryEmail','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Spouse Home Phone Number*:', 260);
			echo( form_input(array('name'=>'homePhoneNumber','id'=>'homePhoneNumber','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Spouse Mobile Phone Number:', 260);
			echo( form_input(array('name'=>'mobilePhoneNumber','id'=>'mobilePhoneNumber','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		
		Spacer::Render(0, 15);
		
		Form::OpenFormItem('Date Joined CMB:', 260);
			echo( form_input(array('name'=>'dateJoinedCmb','id'=>'dateJoinedCmb','style'=>'width: 150px;','onfocus'=>'datePickerController.show(\'dateJoinedCmb\');','onclick'=>'datePickerController.show(\'dateJoinedCmb\');', 'onblur'=>'datePickerController.hide(\'dateJoinedCmb\');')) );
			echo( '<script type="text/javascript">datePickerController.createDatePicker( { formElements:{"dateJoinedCmb":"m-sl-d-sl-Y"} } );</script>' );
		Form::CloseFormItem();
		
		Spacer::Render(0, 15);
		
		Form::OpenFormItem('Spouse Volunteering Interests?', 260);
			echo(  form_checkbox('volunteeringInterests', 'yes', false, 'id="volunteeringInterests"') );
		Form::CloseFormItem();
	
	echo( form_close() );
	
?>
	
	<div class="form-button-container">
		<a href="javascript: populate();">Populate</a>
		<a href="javascript: validate();"><img src="<?php echo( base_url() );?>assets/images/buttons/next_off.gif" border="0" onmouseover="this.src = '<?php echo( base_url() );?>assets/images/buttons/next_over.gif';" onmousedown="this.src = '<?php echo( base_url() );?>assets/images/buttons/next_on.gif';" onmouseup="this.src = '<?php echo( base_url() );?>assets/images/buttons/next_off.gif';" onmouseout="this.src = '<?php echo( base_url() );?>assets/images/buttons/next_off.gif';" /></a>
	</div>

</div>

<script type="text/javascript">
	function validate()
	{
		new Ajax.Request(baseUrl + 'index.php/new_member_sign_up_validation/validate_step2/', 
		{
			method:'post',
			parameters: Form.serialize( $('newMemberStep2Form') ),
		  	onSuccess: function(response)
			{
				var result = response.responseText;
				
				if( result == 'VALIDATION_SUCCESS' )
				{
					$('newMemberStep2Form').submit();
				}
				else
				{
					$('validationErrors').innerHTML = result;
					$('validationErrors').show();
					Effect.ScrollTo('validationErrors', { duration:'0.2', offset:-20 });
				}
			},
			onFailure: function(){ alert('failed') }
		});
	}
	
	
	function populate()
	{
		$('userName').value = 'jane.doe';
		$('password').value = 'registerthis';
		$('firstName').value = 'Jane'
		$('lastName').value = 'Doe'
		$('gender').selectedIndex = 1;
		$('primaryEmail').value = 'jane.doe@email.com';
		$('homePhoneNumber').value = '555-555-5555';
		$('mobilePhoneNumber').value = '';
		$('dateJoinedCmb').value = '06/15/2010';
		$('volunteeringInterests').checked = false;
	}
</script>